// +------------------------------------------------------------------------+
// | XRes - Mac OS X Resource Monitor                                       |
// +------------------------------------------------------------------------+
// | Copyright (c) 2007 Zack Bartel                                         |
// +------------------------------------------------------------------------+
// | This program is free software; you can redistribute it and/or          |
// | modify it under the terms of the GNU General Public License            | 
// | as published by the Free Software Foundation; either version 2         | 
// | of the License, or (at your option) any later version.                 |
// |                                                                        |
// | This program is distributed in the hope that it will be useful,        |
// | but WITHOUT ANY WARRANTY; without even the implied warranty of         |
// | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the          |
// | GNU General Public License for more details.                           |
// |                                                                        |
// | You should have received a copy of the GNU General Public License      |
// | along with this program; if not, write to the Free Software            |
// | Foundation, Inc., 59 Temple Place - Suite 330,                         |
// | Boston, MA  02111-1307, USA.                                           |
// +------------------------------------------------------------------------+
// | Author: Zack Bartel <zack@bartel.com>                                  |
// +------------------------------------------------------------------------+ 
//
//  XRProcess.h
//  XRes
//
//  Created by Zack Bartel on 3/7/08.
//  Copyright 2008 Zack Bartel. All rights reserved.
//


#import <Cocoa/Cocoa.h>

typedef enum _XRProcessState
{
    XRPRocessStateRunning,
    XRProcessStateSuspended
} XRProcessState;

typedef enum _XRProcessOrderBy
{
    XRProcessOrderByCommandName,
    XRProcessOrderByResidentSize,
    XRProcessOrderByVirtualMemorySize,
    XRProcessOrderByPercentCPUUsage,
    XRProcessOrderByUser
} XRProcessOrderBy;

typedef enum _XRProcessAttribute
{
    XRProcessAllProcesses,
    XRProcessUserProcessesOnly,
    XRProcessWindowedProcessesOnly
} XRProcessAttribute;


@interface XRProcess : NSObject {

    NSString        *user;
    int             pid;
    double          percentCPUUsage;
    double          percentResidentMemory;
    int             virtualSize;
    int             residentMemorySize;
    XRProcessState  state;
    NSDate          *dateStarted;
    NSDate          *time;
    NSString        *command;
    NSString        *path;
    BOOL            isWindowed;
}

+ (NSArray *) allProcesses;
+ (NSArray *) allProcessesOrderedBy: (XRProcessOrderBy)orderBy;
+ (NSArray *) allWindowedProcesses;
+ (NSArray *) allProcessesWithAttributes: (XRProcessAttribute) attributes orderedBy: (XRProcessOrderBy) order;
+ (XRProcess *) processWithPid: (int) thePid;

- (NSString *) user;
- (void) setUser: (NSString *) newValue;

- (int) pid;
- (void) setPid: (int) newValue;

- (double) percentCPUUsage;
- (void) setPercentCPUUsage: (double) newValue;

- (double) percentResidentMemory;
- (void) setPercentResidentMemory: (double) newValue;

- (int) virtualSize;
- (void) setVirtualSize: (int) newValue;

- (int) residentMemorySize;
- (void) setResidentMemorySize: (int) newValue;

- (XRProcessState) state;
- (void) setState: (XRProcessState) newValue;

- (NSDate *) dateStarted;
- (void) setDateStarted: (NSDate *) newValue;

- (NSDate *) time;
- (void) setTime: (NSDate *) newValue;

- (NSString *) command;
- (void) setCommand: (NSString *) newValue;

- (NSString *) path;
- (void) setPath: (NSString *) newValue;

- (BOOL) isWindowed;
- (void) setIsWindowed: (BOOL) newValue;

@end


